<?php session_start();
if (!isset($_SESSION["txt_login"]))
{ print "<script type = 'text/javascript'> location.href = 'index.php'</script>"; exit();}


header("Content-Type: text/html; charset=ISO-8859-1",true);

$ac = $_GET["ac"];
$id_vagas = $_GET["id_vagas"];

if($ac=="at"){
mysql_query("update vagas set ativo='S' where id_vagas = '$id_vagas' and id_cadastro_empresa = '".$_SESSION["id_cadastro_empresa"]."'");
}
if($ac=="des"){
mysql_query("update vagas set ativo='N' where id_vagas = '$id_vagas' and id_cadastro_empresa = '".$_SESSION["id_cadastro_empresa"]."'");
}
if($ac=="ex"){
mysql_query("delete from vagas where id_vagas = '$id_vagas' and id_cadastro_empresa = '".$_SESSION["id_cadastro_empresa"]."'");
}


?>

<script type="text/javascript">
        var GB_ROOT_DIR = "./greybox/";
    </script>
     <script type="text/javascript" src="greybox/AJS.js"></script>
    <script type="text/javascript" src="greybox/gb_scripts_home.js"></script>
      <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
<div style="width:794px; float:left; text-transform:capitalize; font-weight: bold; margin-bottom:20px; margin-top:10px; text-decoration:underline;" align="center">Lista de Vagas</div>
<div style="width:780px; height:100%; float:left; background-color: #FFFFFF;">
        <div style="width:780px; float:left; text-transform:capitalize; font-weight: bold;">
          <div style="width:130px;float:left;border:1px solid #155E62;">cargo vaga</div>
        <div style="width:70px;float:left;border:1px solid #155E62;">vagas</div>
        <div style="width:230px;float:left;border:1px solid #155E62;">Empresa</div>
        <div style="width:80px;float:left;border:1px solid #155E62;">data</div>
        <div style="width:85px;float:left;border:1px solid #155E62;">Status</div>
        <div style="width:170px;float:left;border:1px solid #155E62;">A&ccedil;&otilde;es</div>
   
        </div>
        <div style="width:780px; height:100%; float:left;">
          <?php $sq_v = mysql_query("select v.*, cadastro_empresa.nome_fantasia from vagas v, cadastro_empresa where v.id_cadastro_empresa = cadastro_empresa.id_cadastro_empresa");
		        while($linha=mysql_fetch_array($sq_v)){
			   extract($linha);
		  ?>
        
        
        <div style="width:130px; height:45px;float:left; border:1px solid #CCCCCC;"><?php echo $cargo_vaga; ?></div>
        <div style="width:70px;height:45px;;float:left;border:1px solid #CCCCCC;"><?php echo $qtde_vagas ; ?></div>
        <div style="width:230px;height:45px;float:left;border:1px solid #CCCCCC; text-decoration:none;">
        <?php echo $nome_fantasia; ?>
        </div>
        <div style="width:80px;height:45px;float:left;border:1px solid #CCCCCC;"><?php $da=explode("-",$data);echo $da[2]."/".$da[1]."/".$da[0];?></div>
        <div style="width:85px;height:45px;float:left;border:1px solid #CCCCCC;"><?php if($ativo=="S"){echo "<font color=green><b>Ativo</b></font>";}elseif($ativo=="N"){echo "<font color=red><b>Desativado</b></font>";} ?></div>
        <div style="width:170px;height:45px;float:left;border:1px solid #CCCCCC;">
        
        
        <img src="imagens/excluir.gif" onclick='confirmar_exclusao_contato("acao=Excluir&amp;id=<?php echo $id_vagas?>")'><br />
        <a href="visualizar_vaga_admin.php?id_vagas=<?php echo $id_vagas;?>" onclick="return GB_myShow('Visualiza&ccedil;&atilde;o da Vaga', this.href)">Visualizar</a>
        </div>
       
        <?php }?>
         </div>
       
        </div>
        
        
        
        
        <script type="text/javascript">
GB_myShow = function(caption, url, /* optional */ height, width, callback_fn) {
    var options = {
        caption: caption,
        height: height || 1000,
        width: width || 800,
        fullscreen: false,
        show_loading: true,
        callback_fn: callback_fn
    }
    var win = new GB_Window(options);
    return win.show(url);
}
</script>